﻿using Newtonsoft.Json.Serialization;
using System;
using System.Runtime.Serialization;

namespace FileSC.Hangfire
{
#pragma warning disable CS8632
    internal class SerializationBinderAdapter : ISerializationBinder
    {
#pragma warning disable 618
        public readonly SerializationBinder SerializationBinder;
#pragma warning restore 618

#pragma warning disable 618
        public SerializationBinderAdapter(SerializationBinder serializationBinder)
        {
            SerializationBinder = serializationBinder;
        }
#pragma warning restore 618

        public Type BindToType(string? assemblyName, string typeName)
        {
            return SerializationBinder.BindToType(assemblyName!, typeName)!;
        }

        public void BindToName(Type serializedType, out string? assemblyName, out string? typeName)
        {
            SerializationBinder.BindToName(serializedType, out assemblyName, out typeName);
        }
    }
#pragma warning restore CS8632
}
